Repository navigation
feat(console): the docs reader lists the candidate packages when a doc name two packages ship is refused - #34109
Conversation
… as ambiguous A doc name two enabled packages ship is refused by a read that names no package (409 RESOURCE_CONFLICT, holders in details.candidates). The docs reader now lists those packages, each linking to its package address, and a flat permalink under a package container opens that package's own copy in that package's book. Claude-Session: https://claude.ai/code/session_01ADHkmP4uQusF8yrKtRnvqJ Co-authored-by: Claude <noreply@anthropic.com>
…guous doc read Claude-Session: https://claude.ai/code/session_01ADHkmP4uQusF8yrKtRnvqJ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmP4uQusF8yrKtRnvqJ Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf Contract reviewServed-tier: Face: declaration ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-steve · session_01ADHkmT2NE3iyG1o6TDg3sf 席位核对Verdict: ACCEPT · head
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43759582494 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43767190319 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Steve · project thread
Fixes #34070
Waits-on: #34036 — satisfied: merged to main as
5af956f3; this branch mergedorigin/mainat37ea190a.Clause-②: yes (widening) — widened: where a doc read that names no package answers
409 RESOURCE_CONFLICTnaming its holders (details.candidates), the Console docs reader lists those packages, each linking to that package's address/apps/PACKAGE/docs/NAME, where it showed "Failed to load documentation"; a flat permalink under a package container of a name that package ships opens the doc in that package's own book; three@object-ui/i18nkeys (help.docConflictTitle,help.docConflictDescription,help.docConflictCandidates) in all 11 shipped locales, none renamed or removed. A doc one package ships, and every other failure, render as before.Metadata-protocol: none
维护者速读
/apps/包id/docs/文档名下打开那一份,并且侧边栏是那个包自己的书。RESOURCE_CONFLICT且带候选包时生效;单持有者的文档、401/403、404 和其他错误都照旧。另含一处小修:在包容器下打开同名文档时,首页书按该包自己的那份来定(否则会落进另一个包的书)。回滚即还原本 PR。ui/apps/console/src/pages/DocPage.tsx的conflictCandidates与state === 'conflict'分支;ui/apps/console/src/pages/DocsSlug.tsx的ownCopy一行;docs-portal.test.tsx末尾新增的 describe。pnpm --dir ui exec vitest run apps/console/src/pages/docs-portal.test.tsx -t objectstack#34070,预期 4 个用例通过。What changes
PR #34036 (merged as
5af956f3; read first at its heade4b68eb2b) makes a doc read that names no package, of a name two or more enabled packages ship, answer409 RESOURCE_CONFLICTwith every holder named. The envelope this PR reads, and where it was read:PackageScopedNameRefusedError(code = 'RESOURCE_CONFLICT',status = 409,refusal.candidates) inpackages/core/src/package-scoped-resolution.ts; fix(objectql)!: a bare doc read refuses a name two enabled packages hold, naming both #34036 throws it fromreadMetaItemthroughrefuseAmbiguousBareDocRead(packages/metadata-protocol/src/protocol-meta-item-reads.tson its head; on main the judge call inreadMetaItemis unchanged — the file differs from that head only by an unrelated action-artifact hunk).GET /meta/:type/:namehandler answers it withhandleRouteError(res, error, undefined, { packageScopedCandidates: true })(packages/rest/src/meta-item-read-routes.ts), which puts the holders atdetails.candidates(packageScopedCandidatesMember,packages/rest/src/error-response.ts).unwrapResponseinpackages/client/src/index.tssetserr.code,err.httpStatusanderr.details = errorBody.detailson the rejection.content/docs/api/client-sdk.mdx, the/meta409 section ("The server picks no holder for you"):err.httpStatus === 409 && err.code === 'RESOURCE_CONFLICT', thenerr.details?.candidates=[{ kind: 'package', packageId }, …]. The head and the docs agree.Where the 409 lands in the Console: a flat
/docs/NAMEpermalink of a name in the member's doc list redirects (DocsSlug) to/docs/BOOK/NAME, and DocPage's read there names no package, so the refusal reaches DocPage, which rendered "Failed to load documentation". The change sits there:DocPage.tsx:conflictCandidates(err)reads a409RESOURCE_CONFLICTrejection'sdetails.candidatesand keeps thepackageholders. Non-empty ⇒ aconflictstate: a "Choose a package" list, each entry labelled as the portal names the package (its home book for this doc,homeBook(name, books, docs, packageId)), the package id beside it, linking to/apps/PACKAGE/docs/NAME(the package container's flat permalink, the address the app header's docs link already uses). Every other failure keeps today's branch.DocsSlug.tsx+book-nav.ts:homeBooktakes an optionalpackageId. Under/apps/PACKAGE/docs/NAME, when that package shipsNAME, its own copy decides the home book. Without this, the redirect took the first listed doc of the name, so a candidate link landed in the OTHER package's book (content right, since DocPage reads with?package=, sidebar wrong). No other URL changes its answer: the package is passed only when the container ships the name.@object-ui/i18n:help.docConflictTitle,help.docConflictDescription({{name}}),help.docConflictCandidates, in all 11 locale packs;zh-Hant.tsregenerated withgen-zh-hant.mjsfromzh-Hans.ts.Candidates of another kind (
environment,platform,residual) are not listed: for adocthe environment's own item answers first (#34036), so a doc refusal names packages only; a refusal naming no package keeps today's error state.Tests
New top-level describe in the shared harness
ui/apps/console/src/pages/docs-portal.test.tsx(real DocsLayout / DocsSlug / DocPage under the real route table,/docsand/apps/:appName/docs), with a third adapter world:shared_guideshipped bycom.example.beta(listed first) andcom.example.alpha; a read of it with no package rejects the way@objectstack/clientdoes on the 409 (httpStatus,code,details.candidates); with a package it answers that package's copy./apps/PACKAGE/docs/shared_guide, labelledAlpha/Betawith the id beside it; no doc body, no load error./apps/com.example.alpha/docs/com.example.alpha/shared_guidewith alpha's body, beta likewise.No existing test was edited (the hoisted adapter gained the third world, switched on only inside the new describe).
Ablation (two legs, each red, each restored)
Both through
scripts/ablation-replace.mjs, pins run with-t objectstack#34070(ui vitest resolves@object-ui/*and the Console tosrc/, so no build sits between mutation and run):if (holders) {toif (holders && (false as boolean)) {in DocPage): anchor 1 to 0, blob217c8533to19bdbb86; 2 failed, 2 passed (both candidate pins:Unable to find role="list"). Restored: blob equal to HEAD,git diff HEADempty.homeBook(slug, books, docs, ownCopy ? appName : undefined)tohomeBook(slug, books, docs, undefined)in DocsSlug): anchor 1 to 0, blob6164bc8bto37d661e1; 1 failed, 3 passed (expected '/apps/com.example.alpha/docs/com.example.beta/shared_guide'where alpha's book was pinned). Restored: blob equal to HEAD,git diff HEADempty.Acceptance notes
DocsSlug.tsx/DocShell.tsx"as located"; the refusal lands inDocPage.tsx(the reader's read is the one that names no package), so the chooser is there. DocsSlug's single-name probe (refusalFor, run only for a name the member's lists do not carry) still reads only 401 / 403 as an answer; a 409 there keeps today's fallback. Not exercised: a name both holders ship is in the member's list, so that probe does not run for it.?package=doc read answering that package's doc. metadata-protocol: an exact read of a doc (?package=A) of a name two packages ship can answer the other package's doc, because the metadata service keeps a doc by name alone #34040 tracks a composed artifact server answering the other holder's doc there; not in this PR.5af956f3),origin/mainwas merged into this branch at37ea190aand the pins re-run there (Verification, round 2).Verification
Round 2, after #34036 merged — head
37ea190a(merge oforigin/main385ea1ccintobe6b38f6, no conflict): the envelope files are byte-identical to the #34036 head read in round 1 (git diff --quietexit 0 forpackages/core/src/package-scoped-resolution.ts,packages/rest/src/meta-item-read-routes.ts,packages/rest/src/error-response.ts,packages/client/src/index.ts,content/docs/api/client-sdk.mdx);packages/metadata-protocol/src/protocol-meta-item-reads.tsandpackages/objectql/src/registry.tsequal the merge commit5af956f3's, withrefuseAmbiguousBareDocReadcalled at the same spot. The branch delta againstorigin/mainis still these 16 files (+264 / -14). Afterpnpm install --frozen-lockfileand rebuilding@objectstack/client...,@objectstack/formula...,@objectstack/sdui-parser...(VERDICT command-exit 0): pins-t objectstack#340704 passed;apps/console/src/pages/159 files, 1333 tests passed;packages/i18n/102 files, 1894 passed, 13 skipped.Round 1: All readings at head
be6b38f6(this branch), objectstack-ai/objectstack, base63db7240. The ablation legs ran at9854afce, whoseui/apps/consoletree is byte-identical at this head (git diff --quietexit 0; the later commits add the changeset and regeneratezh-Hant.ts); the pins were re-run at this head.Suites, lint, gates
pnpm --dir ui exec vitest run apps/console/src/pages/docs-portal.test.tsx: 28 passed (24 existing + 4 new).pnpm --dir ui exec vitest run packages/i18n/: 102 files, 1894 passed, 13 skipped (zh-hant-generated,all-locales-key-parityincluded).node ui/scripts/check-i18n-call-site-keys.mjs,check-i18n-dead-keys.mjs,check-i18n-en-drift.mjs: each exit 0.pnpm check:new-line-citations(ui): 0 new, exit 0.eslinton the four console files: 0 errors (2 existinganywarnings on untouched lines).dispatch-gates.mjs --commands(no paths, atbe6b38f6): 39 derived, 39 run, each exit 0 (under the verify lock,VERDICT command-exit 0);--ranreconciliation: 39 accounted, 0 NOT-MEASURED.pnpm --dir ui exec vitest run apps/console/src/pages/atbe6b38f6: 159 files, 1333 tests passed.pnpm run type-check(tsc --noEmitandtsc -b tsconfig.node.json) after building@object-ui/console^...:VERDICT command-exit 0;--listFilesholds all four edited console files.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmP4uQusF8yrKtRnvqJ